﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DesignPatterns.Strategy
{
    public class CashContext
    {
        private CashSuper cash;

        public CashContext(string type)
        {
            switch (type)
            {
                case "正常收费":
                    cash = new CashNormal();
                    break;
                case "满300返100":
                    cash = new CashReturn(300, 100);
                    break;
                case "打8折":
                    cash = new CashRebate(0.8M);
                    break;
            }
        }

        public decimal GetResult(decimal money)
        {
            return cash.AcceptCash(money);
        }
    }
}
